﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Green.ObjectPickUper
{
    public abstract class ObjectPickUperBase : IObjectPickUper
    {
        public ObjectPickUperBase()
        {
           IsSOAObject= this.IsImplementINotifyPropertyChanged = true;
        }
        #region IObjectPickUper 成员

        public abstract string PickUp(Type pickedType, string suffix);

        public string PickUp<T>(string suffix)
        {
            return PickUp(typeof(T), suffix);
        }

        public Dictionary<string, string> PickUp(IList<Type> pickedType, string suffix)
        {
            Dictionary<string, string> dict = new Dictionary<string, string>();
            pickedType.ToList().ForEach(
                t =>
                {
                    var pickName = string.Format("{0}{1}", t.Name, suffix);
                    dict.Add(pickName, PickUp(t, suffix));
                });
            return dict;
        }

        public Type BaseType
        {
            get;
            set;
        }

        public bool IsImplementINotifyPropertyChanged
        {
            get;
            set;
        }

        /// <summary>
        /// 是wcf对象？
        /// </summary>
        public bool IsSOAObject
        {
            get;
            set;
        }
        #endregion
    }
}
